
export const getBirthDay = (dateStr: string) => {
  let result = ''
  let res = dateStr && dateStr.split(' ');
  if(res && res.length > 0) {
    result = res[0]
  }

  return result;
}

export const getTimeminute = (dateStr: string) => {
  let result = ''
  let res = dateStr.split(' ');
  if(res.length > 0) {
    let strArr = res[1].split(':')
    result = strArr[0] + ':' + strArr[1]
  }

  return result;
}


// output 2021-12-07 星期二 09:00
export const getweekDate = (dateStr: string) => {
  let result = ''
  let res = dateStr.split(' ');
  let dateEach = ['日', '一', '二', '三', '四', '五', '六']
  let hour = ''
  
  if(res.length > 0) {
    let date = res[0].split('-');
    let hours = res[1].split(':')
    if(hours.length > 0) {
      hour = hours[0] + ':' + hours[1]
    }
    let y = Number(date[0])
    let m = Number(date[1])
    let d = Number(date[2])
    let strArr = new Date(y, m - 1, d).getDay()

    result = `${res[0]}星期${dateEach[strArr]}${hour}`
  }

  return result;
}